package cj.web.portal.dao;

import java.util.List;
import java.util.Map;

import net.paoding.rose.jade.annotation.DAO;
import net.paoding.rose.jade.annotation.SQL;

/**
 * 
 * @author HanMin
 *
 *         2015年12月30日
 */
@DAO
public interface NewMediaDAO {

	// 微博汇列表ByMatrixType
	@SQL("SELECT id,title,matrixType,category,carouselImage,qrCode,website,content,iosqrCode FROM NewMediaMatrix WHERE deleteFlag=1 and matrixType = :1  ORDER BY orderNo  LIMIT :2,:3 ")
	List<Map> queryWBByMatrixType(String matrixType, int start, int length);

	// 微博汇列表size
	@SQL("SELECT count(*) FROM NewMediaMatrix WHERE deleteFlag=1 and matrixType = :1 ")
	int queryWBByMatrixTypeCount(String matrixType);

	// 微信汇列表ByCategory
	@SQL("SELECT id,title,matrixType,category,carouselImage,qrCode,website,content,iosqrCode FROM NewMediaMatrix WHERE deleteFlag=1 and matrixType = 2 #if(:1!=''){AND category = :1 } ORDER BY orderNo  LIMIT :2,:3 ")
	List<Map> queryWXByCategory(String category, int start, int length);
	
	// 微信汇列表ByCategory
	@SQL("SELECT id,title,matrixType,category,carouselImage,qrCode,website,content,iosqrCode FROM NewMediaMatrix WHERE deleteFlag=1 and matrixType = 2 AND category = :1 ORDER BY orderNo  ")
	List<Map> queryWXByCategory(String category);
	
	// 微博汇列表size
	@SQL("SELECT count(*) FROM NewMediaMatrix WHERE deleteFlag=1 and matrixType = 2 #if(:1!=''){AND category = :1 } ")
	int queryWXByCategoryCount(String category);
	
	// 查询ById
	@SQL("SELECT id,title,matrixType,category,carouselImage,qrCode,website,content,iosqrCode FROM NewMediaMatrix WHERE deleteFlag=1 and id=:1  ORDER BY orderNo ")
	List<Map> queryById(String id);
}
